package com.fusion.lottery.mapper.auth;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.fusion.lottery.entity.auth.Source;

public interface SourceMapper {
	
	/**
	 * 
	 * @param source
	 * @param start
	 * @param pageSize
	 * @return
	 */
	@Select({
		"<script>",
		"SELECT * FROM t_auth_security_resources ",
		" <when test='pageSize > 0'> limit #{start},#{pageSize}</when> ",
		"</script>"
		})
	List<Source> list(Source source,@Param("start")long start,@Param("pageSize")long pageSize);
	
	/**
	 * 
	 * @param source
	 * @return
	 */
	@Select("SELECT count(1) FROM t_auth_security_resources")
	long count(Source source);
	
	/**
	 * 
	 * @param id
	 * @return
	 */
	@Select("SELECT * FROM t_auth_security_resources WHERE id = #{id}")
	Source get(long id);
	
	/**
	 * 修改权限状态
	 * @param source
	 */
	@Update("update t_auth_security_resources set status=#{status} where id= #{id}")
	void update(Source source);
}
